﻿import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class FileInputStream {
	public static void main(String[] args) {
		FileInputStream fis=null;
		
			try {
				fis =new FileInputStream("d://1.txt");
			
			int data;
			System.out.println("可读字节数："+fis.available());
			System.out.print("文件内容为：");
			while((data=fis.read())!=-1){
				System.out.print((char)data+" ");
			}
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block

				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block

				e.printStackTrace();
			}finally{
				if(fis!=null){
					try {
						fis.close();
					} catch (IOException e) {
						// TODO Auto-generated catch block

						e.printStackTrace();
					}
				}
			}
	}
}